/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.isn.atencionemergencia.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author pool
 */
@Entity
@Table(name = "tipo_lesion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TipoLesion.findAll", query = "SELECT t FROM TipoLesion t"),
    @NamedQuery(name = "TipoLesion.findByCodTiplesion", query = "SELECT t FROM TipoLesion t WHERE t.codTiplesion = :codTiplesion"),
    @NamedQuery(name = "TipoLesion.findByDescTiplesion", query = "SELECT t FROM TipoLesion t WHERE t.descTiplesion = :descTiplesion")})
public class TipoLesion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "Cod_Tiplesion", columnDefinition="CHAR(5) unsigned")
    private String codTiplesion;
    @Column(name = "Desc_Tiplesion")
    private String descTiplesion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "codTiplesion")
    private Collection<Lesion> lesionCollection;

    public TipoLesion() {
    }

    public TipoLesion(String codTiplesion) {
        this.codTiplesion = codTiplesion;
    }

    public String getCodTiplesion() {
        return codTiplesion;
    }

    public void setCodTiplesion(String codTiplesion) {
        this.codTiplesion = codTiplesion;
    }

    public String getDescTiplesion() {
        return descTiplesion;
    }

    public void setDescTiplesion(String descTiplesion) {
        this.descTiplesion = descTiplesion;
    }

    @XmlTransient
    public Collection<Lesion> getLesionCollection() {
        return lesionCollection;
    }

    public void setLesionCollection(Collection<Lesion> lesionCollection) {
        this.lesionCollection = lesionCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codTiplesion != null ? codTiplesion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TipoLesion)) {
            return false;
        }
        TipoLesion other = (TipoLesion) object;
        if ((this.codTiplesion == null && other.codTiplesion != null) || (this.codTiplesion != null && !this.codTiplesion.equals(other.codTiplesion))) {
            return false;
        }
        return true;
    }

}
